package main

import (
	"context"
	"user/biz/service"
	user "user/kitex_gen/user"
)

// UserServiceImpl implements the last service interface defined in the IDL.
type UserServiceImpl struct{}

// AddUser implements the UserServiceImpl interface.
func (s *UserServiceImpl) AddUser(ctx context.Context, user *user.User) (resp bool, err error) {
	resp, err = service.NewAddUserService(ctx).Run(user)

	return resp, err
}

// DeleteUser implements the UserServiceImpl interface.
func (s *UserServiceImpl) DeleteUser(ctx context.Context, id int64) (resp bool, err error) {
	resp, err = service.NewDeleteUserService(ctx).Run(id)

	return resp, err
}

// EditUser implements the UserServiceImpl interface.
func (s *UserServiceImpl) EditUser(ctx context.Context, user *user.User) (resp bool, err error) {
	resp, err = service.NewEditUserService(ctx).Run(user)

	return resp, err
}

// GetUserInfo implements the UserServiceImpl interface.
func (s *UserServiceImpl) GetUserInfo(ctx context.Context, user *user.User) (resp *user.User, err error) {
	resp, err = service.NewGetUserInfoService(ctx).Run(user)

	return resp, err
}

// GetUserList implements the UserServiceImpl interface.
func (s *UserServiceImpl) GetUserList(ctx context.Context, offset int64, limit int64) (resp []*user.User, err error) {
	resp, err = service.NewGetUserListService(ctx).Run(offset, limit)

	return resp, err
}
